#ifndef __MATRIX_KEY_H__
#define __MATRIX_KEY_H__
#include "GPIO.h"

#define ROW1 P34
#define ROW2 P35
#define ROW3 P40
#define ROW4 P41

#define COL1 P03
#define COL2 P06
#define COL3 P07
#define COL4 P17

#define DOWN 0
#define UP   1
#define IS_KEY_DOWN(s,r,c)  (s & (1 << (r*4 + c))) == 0
#define IS_KEY_UP(s,r,c)    (s & (1 << (r*4 + c))) != 0
#define SET_KEY_UP(s,i,j)   status |= 1<<(4*i + j)
#define SET_KEY_DOWN(s,i,j) status &= ~(1<<(4*i + j))


void MK_Init();

void MK_Scan();




#endif